(function($, doc) {
	$.init();
	var user = app.getState();
	//var bitcoin = require('bitcoinjs-lib');
	console.log(foo.bitcoin);
	doc.getElementById('sub').addEventListener('tap', function(){
		var etype = doc.querySelector('.mui-active').getAttribute('id');
		//var postdata = {etype : etype, uid : user.user_id};
		var oldpwd = doc.getElementById('oldpasswd').value;
		var pwd = doc.getElementById('passwd').value;
		var repwd = doc.getElementById('repasswd').value;
		if(!oldpwd || app.checkPwd(oldpwd, 6) === false || !pwd || app.checkPwd(pwd, 6) === false) {
			$.toast('钱包密码必须字母加数字6位以上');
			return;
		}
		if(pwd == oldpwd) {
			$.toast('新旧密码一致！');
			return;
		}
		if(pwd != repwd) {
			$.toast('两次输入密码不一致！');
			return;
		}
		//postdata['old'] = oldpwd;
		//postdata['pwd'] = pwd;
		if(etype == 'eth'){
			var myWallet = ethscan.getWallet('eth');
		}else if(etype == 'btc'){
			var myWallet = ethscan.getWallet('btc');
		}else if(etype == 'eos'){
			var myWallet = ethscan.getWallet('eos');
		}
		if(!myWallet){
			$.toast("您还没有创建钱包！");
			return;
		}
		if(myWallet.passwd != md5(oldpwd)) {
			$.toast("旧密码错误！");
			return;
		}
		ethscan.editWallet('passwd', md5(pwd), etype);
		$.toast("修改成功！");
		
		
	});
}(mui, document));